#include "Server.h"

Server::Server( int id, QObject *parent ) :
    QObject(parent),
    mId( id )
{
    // Init.
    mCheckStats = false;
    mLoad1 = 0.0f;
    mLoad5 = 0.0f;
    mLoad15 = 0.0f;
    mName = "";
    mMaxLoad1 = 10.0f;
    mMaxLoad5 = 8.0f;
    mMaxLoad15 = 5.0f;
    mMaxPing = 1000;
    mPing = 0;
    mUrl.setUrl( "" );
}

bool Server::checkStats() const
{
    return mCheckStats;
}

float Server::loadOne() const
{
    return mLoad1;
}

float Server::loadFive() const
{
    return mLoad5;
}

float Server::loadFifteen() const
{
    return mLoad15;
}

float Server::maxLoadOne() const
{
    return mMaxLoad1;
}

float Server::maxLoadFive() const
{
    return mMaxLoad5;
}

float Server::maxLoadFifteen() const
{
    return mMaxLoad15;
}

int Server::maxPing() const
{
    return mMaxPing;
}

QString Server::name() const
{
    return mName;
}

int Server::ping() const
{
    return mPing;
}

void Server::setCheckStats( bool check )
{
    mCheckStats = check;
}

void Server::setLoadOne( float value )
{
    mLoad1 = value;

    emit dataChanged( mId );
}

void Server::setLoadFive( float value )
{
    mLoad5 = value;

    emit dataChanged( mId );
}

void Server::setLoadFifteen( float value )
{
    mLoad15 = value;

    emit dataChanged( mId );
}

void Server::setMaxLoadOne( float value )
{
    mMaxLoad1 = value;
}

void Server::setMaxLoadFive( float value )
{
    mMaxLoad5 = value;
}

void Server::setMaxLoadFifteen( float value )
{
    mMaxLoad15 = value;
}

void Server::setMaxPing( int ping )
{
    mMaxPing = ping;
}

void Server::setName( const QString &name )
{
    mName = name;

    emit dataChanged( mId );
}

void Server::setPing( int ping )
{
    mPing = ping;

    emit dataChanged( mId );
}

void Server::setUrl( const QUrl &url )
{
    mUrl = url;

    emit dataChanged( mId );
}

QUrl Server::url() const
{
    return mUrl;
}
